﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="GoogleMap" Namespace="Reimers.Map" TagPrefix="Reimers" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
    	function handleClick(point, overlay) {
    		if (point) {
    			MapService.HandleClick(reimers.map.json.convertToJsonLatLng(point), reimers.map.sMap.getOverlayState(), onClickResponse, onClickFail, point);
    		}
        }
        
        function onClickResponse(result, context){
            if (result) {
                var mrk = reimers.map.json.convertToGMarker(reimers.map.sMap,result.Key);
                reimers.map.sMap.addOverlay(mrk);
                eval(result.Value);
            }
        }
        
        function onClickFail(error){
        
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server">
        <Services>
            <asp:ServiceReference Path="~/MapService.asmx" />
        </Services>
    </asp:ScriptManager>
    <Reimers:GoogleMap runat="server" ID="sMap" Width="512" Height="500" Zoom="10">
        <ClientSideHandlers OnClick="handleClick(point,overlay);" />
    </Reimers:GoogleMap>
    <asp:Button runat="server" Text="Click" />
    </form>
</body>
</html>
